from django.urls import path
from rest_framework import routers

from dvadmin.system.views.api_white_list import ApiWhiteListViewSet
from dvadmin.system.views.area import AreaViewSet
from dvadmin.system.views.clause import PrivacyView, TermsServiceView
from dvadmin.system.views.datav import DataVViewSet
from dvadmin.system.views.dept import DeptViewSet
from dvadmin.system.views.dictionary import DictionaryViewSet
from dvadmin.system.views.file_list import FileViewSet
from dvadmin.system.views.login_log import LoginLogViewSet
from dvadmin.system.views.menu import MenuViewSet
from dvadmin.system.views.menu_button import MenuButtonViewSet, ButtonViewSet
from dvadmin.system.views.operation_log import OperationLogViewSet
from dvadmin.system.views.role import RoleViewSet
from dvadmin.system.views.system_config import SystemConfigViewSet
from dvadmin.system.views.user import UserViewSet

# ]
# urlpatterns += system_url.urls
system_url = routers.SimpleRouter()  # 创建一个SimpleRouter实例
system_url.register(r'menu', MenuViewSet)  # 注册菜单相关的路由
system_url.register(r'button', ButtonViewSet)  # 注册按钮相关的路由
system_url.register(r'menu_button', MenuButtonViewSet)  # 注册菜单按钮相关的路由
system_url.register(r'role', RoleViewSet)  # 注册角色相关的路由
system_url.register(r'dept', DeptViewSet)  # 注册部门相关的路由
system_url.register(r'user', UserViewSet)  # 注册用户相关的路由
system_url.register(r'operation_log', OperationLogViewSet)  # 注册操作日志相关的路由
system_url.register(r'dictionary', DictionaryViewSet)  # 注册字典相关的路由
system_url.register(r'area', AreaViewSet)  # 注册地区相关的路由
system_url.register(r'file', FileViewSet)  # 注册文件相关的路由
system_url.register(r'api_white_list', ApiWhiteListViewSet)  # 注册API白名单相关的路由
system_url.register(r'system_config', SystemConfigViewSet)  # 注册系统配置相关的路由
system_url.register(r'datav', DataVViewSet)  # 注册DataV相关的路由

urlpatterns = [
    # 获取指定角色ID的菜单信息
    path('role/roleId_get_menu/<int:pk>/', RoleViewSet.as_view({'get': 'roleId_get_menu'})),
    # 获取web路由信息
    path('menu/web_router/', MenuViewSet.as_view({'get': 'web_router'})),
    # 获取用户信息和更新用户信息
    path('user/user_info/', UserViewSet.as_view({'get': 'user_info', 'put': 'update_user_info'})),
    # 保存系统配置内容
    path('system_config/save_content/', SystemConfigViewSet.as_view({'put': 'save_content'})),
    # 获取关联表信息
    path('system_config/get_association_table/', SystemConfigViewSet.as_view({'get': 'get_association_table'})),
    # 根据主键获取表数据
    path('system_config/get_table_data/<int:pk>/', SystemConfigViewSet.as_view({'get': 'get_table_data'})),
    # 获取关系信息
    path('system_config/get_relation_info/', SystemConfigViewSet.as_view({'get': 'get_relation_info'})),
    # 获取登录日志列表
    path('login_log/', LoginLogViewSet.as_view({'get': 'list'})),
    # 根据主键获取登录日志详情
    path('login_log/<int:pk>/', LoginLogViewSet.as_view({'get': 'retrieve'})),
    # 获取部门树形结构数据
    path('dept_lazy_tree/', DeptViewSet.as_view({'get': 'dept_lazy_tree'})),
    # 获取隐私政策页面
    path('clause/privacy.html', PrivacyView.as_view()),
    # 获取服务条款页面
    path('clause/terms_service.html', TermsServiceView.as_view()),

]
urlpatterns += system_url.urls  # 将system_url模块中的urls添加到当前urlpatterns中
